# ICON0.PNG extractor # Since psp2d only opens images in files (not in buffer) we need to extract all the icons # this is done only once and it's pretty fast so no need to change it for now from define import * import os, traceback, re def extract_icon(path_to_eboot): # Extract icon0 from eboot try: try: x = open(path_to_eboot+"EBOOT.PBP","r").read(256000).encode("hex") except: x = open(path_to_eboot+"wmenu.bin","r").read(256000).encode("hex") r = re.compile("504e47(.*?)49454e44ae426082") m = r.search(x) icon = "89" + m.group() y = open(path_to_eboot+"icon0.png","w") y.write(icon.decode("hex")) y.close() x = "" icon = "" r = "" m = "" except: traceback.print_exc(file=open("log.txt","a+")) open(path_to_eboot+"/icon0.png","wb").write(open("NOICON.PNG","rb").read()) x = "" icon = "" r = "" m = "" def check_icons(): # Recursively check if icons are extracted, if not, extract them root, dirs, files = os.walk("ms0:/PSP/GAME").next() for i in dirs: try: open(root+"/"+i+"/icon0.png","rb").close() except: extract_icon(root+"/"+i+"/")